package com.war.dao.system;

import com.war.pojo.system.User;
import com.war.pojo.system.Warehouse;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WarehouseDao {
    //查询仓库
    @Select("select * from sys_warehouse")
    List<Warehouse> selectAll();

    //查询仓库名称
    @Select("select name from sys_warehouse")
    List<Warehouse> selectName();

    //根据仓库名查仓库
    @Select("select * from sys_warehouse where name=#{name}")
    Warehouse selectByName(Warehouse warehouse);

    //根据id查仓库
    @Select("select * from sys_warehouse where id=#{id}")
    Warehouse selectById(Warehouse warehouse);

    //根据存放商品类型查仓库
    @Select("select * from sys_warehouse where type=#{type}")
    Warehouse selectByType(Warehouse warehouse);

    //删除
    @Delete("delete from sys_warehouse where id=#{id}")
    int delWare(Warehouse warehouse);

    //修改信息
    @Update("update sys_warehouse set name=#{name}, manager=#{manager}, type=#{type}, number=#{number}, tel=#{tel} where id=#{id}")
    int updateWare(Warehouse warehouse);

    //注册
    @Insert("insert into sys_warehouse(name, manager, type, number, tel) value(#{name}, #{manager}, #{type}, #{number}, #{tel})")
    int addWare(Warehouse warehouse);

}
